package zj.xinxin.web.controller.home;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import zj.xinxin.common.annotation.Log;
import zj.xinxin.common.constant.LogConst;
import zj.xinxin.common.result.ResponseResult;
import zj.xinxin.web.utils.BaseController;

/**
 * @author junzhou
 * @date 2022/4/12 17:13
 * @since 1.8
 */
@RestController
@RequestMapping("/index")
@Api(tags = "主页相关信息")
public class IndexController extends BaseController {

    @ApiOperation(value = "获取用户信息")
    @Log(logType = LogConst.LOG_TYPE_QUERY)
    @GetMapping("/getUserList")
    public ResponseResult<Authentication> getUserInfo(){
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

        return ResponseResult.success(authentication);
    }
}
